package com.example.cloud.controller.inventory;

import com.example.cloud.controller.common.BaseController;
import com.example.cloud.model.dto.QueryModel;
import com.example.cloud.model.dto.Result;
import com.example.cloud.model.inventory.Inventory;
import com.example.cloud.service.inventory.InventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by wangtao on 2018/8/18.
 * 库存管理
 */
@RestController
@RequestMapping("/inventory")
public class InventoryController extends BaseController {

    @Autowired
    private InventoryService inventoryService;

    @PostMapping("/search")
    public Result search(@RequestBody QueryModel model) {
        return this.singleQuery(model, Inventory.class);
    }

    @PostMapping("/inbound")
    public void inbound(@RequestBody Inventory record){
        inventoryService.doSave(record);
    }
}
